package com.sjk.eurekaperson.controller;


import com.sjk.eurekaperson.entity.TPerson;
import com.sjk.eurekaperson.service.ITPersonService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author sjk
 * @since 2021-11-05
 */
@RestController
@RequestMapping("/t-person")
public class TPersonController {
    @Autowired
    ITPersonService itPersonService;

    /**
     * 展示所有的数据
     * @return
     */
    @RequestMapping("list")
    public List<TPerson> list(){
        List<TPerson> list = itPersonService.list();
        System.err.println(list);
        return list;
    }
    @RequestMapping("login")
    public TPerson login(@RequestBody TPerson tPerson){
        TPerson person = itPersonService.getlist(tPerson);
        System.err.println(person);
        if (person==null){
            System.err.println("空");
            TPerson person1 = new TPerson();
            person1.setName("false");
            person1.setPassword("false");
            return person1;
        }
        return person;
    }
}
